<?php
class Email {
    public static function send($subject, $content, $to) {
        // Create the Transport
        $transport = Swift_SmtpTransport::newInstance('smtp.qq.com', 25);
        $transport->setUsername(MAIL_SENDER);
        $transport->setPassword(MAIL_SENDER_PWD);

        // Create the message
        $message = Swift_Message::newInstance();
        $message->setSubject($subject);
        $message->setFrom(array(MAIL_SENDER => MAIL_SENDER_NAME));
        $message->setTo($to);
        $message->setBody($content, 'text/html');

        // Create the Mailer using your created Transport
        $mailer = Swift_Mailer::newInstance($transport);

        // Send the message
        try {
            $result = $mailer->send($message);
            return $result;
        } catch(Exception $e) {
            echo "\nsend mail error: ".$e->getMessage();
        }
    }
}